package com.ma.gulimall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ma.gulimall.order.entity.OrderEntity;
import com.ma.gulimall.order.vo.*;
import com.ma.gulimall.to.mq.SeckillOrderTo;
import com.ma.gulimall.utils.PageUtils;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author mayongqiang
 * @email 178780494@qq.com
 * @date 2021-06-13 23:21:49
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页返回需要用的数据
     *
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 下单 提交订单
     *
     * @param vo
     * @return
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    /**
     * 按照订单号获取订单信息
     *
     * @param orderSn
     * @return
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     *
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity);

    /**
     * 根据订单号得到订单vo
     *
     * @param orderSn
     * @return
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 分页查询订单数据，给远程会员服务调用
     *
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝异步通知结果
     *
     * @param asyncVo
     * @return
     */
    String handlePayResult(PayAsyncVo asyncVo);

    /**
     * 创建秒杀订单
     * @param seckillOrder
     */
    void createSeckillOrder(SeckillOrderTo seckillOrder);
}

